/**
 * @author lk
 * @date 2022/5/18 16:38
 */
package com.two.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@Controller
public class ShareScopeController {
    //    @RequestMapping("/share")
    public String test3(HttpServletRequest request) {
        request.setAttribute("name", "tom");
        return "share";
    }

    @RequestMapping("/share")
    public ModelAndView test4(ModelAndView mav, Model modl) {
        mav.addObject("name", "jack");
        mav.setViewName("share");
        System.out.println(mav.getClass().getName());
        return mav;
    }

    @RequestMapping("/abc")
    public List<Integer> test5() {
        ArrayList<Integer> integers = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            integers.add(i);
        }
        return integers;
    }
}
